#define  _CRT_SECURE_NO_WARNINGS
#include <vector>
using namespace std;

class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int x = 0;
        for (int i = 0; i <= nums.size(); i++)
            x ^= i;
        for (auto e : nums)
            x ^= e;
        return x;
    }
};